package xkp.lesson4;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TestPing {
	public static void main(String[] args) throws IOException {
		Runtime runtime = Runtime.getRuntime();
		Process process = runtime.exec("ping -t www.baidu.com");
		BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream(), "gbk"));
		String inline;
	
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		while ((inline = br.readLine()) != null) {
			String string = new String(inline.getBytes());
			System.out.print(string);
			System.out.print("\t");
			Date date = new Date();
			System.out.println(dateFormat.format(date));
		}
		br.close();
	}
}
